﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using Tank90.Properties;

namespace Tank90
{
    /// <summary>
    /// 闪耀登场类
    /// </summary>
    class Born : Element
    {
        private int bornTimer = 0;
        private static Image[] bornImg = { Resources.born1, Resources.born2, Resources.born3, Resources.born4 };
        
        public Born(int x, int y)
        {
            this.x = x;
            this.y = y;
        }

        #region 闪耀登场

         /// <summary>
        /// 闪耀登场动画
        /// </summary>
        /// <param name="g"></param>
        public override void Drawing(Graphics g)
        {
            if (bornTimer < 48)
            {
                switch (bornTimer % 8)
                {
                    case 0:
                    case 1:
                        g.DrawImage(bornImg[0], this.x, this.y);
                        break;
                    case 2:
                    case 3:
                        g.DrawImage(bornImg[1], this.x, this.y);
                        break;
                    case 4:
                    case 5:
                        g.DrawImage(bornImg[2], this.x, this.y);
                        break;
                    case 6:
                    case 7:
                        g.DrawImage(bornImg[3], this.x, this.y);
                        break;
                    default: break;
                }
                bornTimer++;
            }
        }
        #endregion
    }
}
